#include <stdio.h>

const int MaxN=20;

int main(){
    int a,b,n,x,m;
    int i;

    //车上剩余人数a b对应的系数
    int *array_a,*array_b;

    //斐波拉契数列
    int fb[MaxN];
    fb[0]=0;
    fb[1]=1;

    //计算斐波拉契数列
    for(i=2;i<MaxN;i++)
    {
        fb[i]=fb[i-1]+fb[i-2];

        // printf("%d\n",fb[i]);
    }

    scanf("%d %d %d %d",&a,&n,&m,&x);

    if(x==n)
    {
        printf("0\n");
    }
    else{
        int len=n<=4?4:n;
        array_a=new int[len];
        array_b=new int[len];
        array_a[0]=1;
        array_a[1]=1;
        array_a[2]=2;
        array_a[3]=2;

        array_b[0]=0;
        array_b[1]=0;
        array_b[2]=0;
        array_b[3]=1;

        for(i=4;i<n-1;i++)
        {
            array_a[i]=array_a[i-1]+fb[i-3];
            array_b[i]=array_b[i-1]+fb[i-2];
        }

        // for(i=0;i<n-1;i++)
        // {

        //     printf("%d %d %d\n",i,array_a[i],array_b[i]);
        // }
        if(array_b[x-1]==0)
        {
            int result=array_a[x-1]*a;
            printf("%d\n",result);
        }
        else{
            b=(m-array_a[n-2]*a)/array_b[n-2];
            int result=array_a[x-1]*a+array_b[x-1]*b;
            printf("%d\n",result);
        }

        delete array_b;
        delete array_a;
    }
    
    
    

}